package com.desksoft.ecommerce.vo.mall;

import java.util.ArrayList;
import java.util.List;

import com.desksoft.ecommerce.base.Entity;

public class BuyItemVO implements Entity{

	

	/**
	 * 
	 */
	private static final long serialVersionUID = -6026905127850726464L;
	
	/**
	 * 单个商品促销信息
	 */
	private List<PromotionItemVO> promotionItemVOList;

	
	/**
	 * 单项商品小计
	 */
	private float subtotal;
	
	/**
	 * 要货量(整合之后的)
	 */
	private int camount;
	
	/**
	 * 可配数
	 */
	private int stockqty;
	
	/**
	 * 缺货是否已预定
	 */
	private boolean stockfix;
	
	/**
	 * 要货的整数
	 */
	private int wholeqty;
	
	/**
	 * 要货的零数
	 */
	private int subqty;
	/**
	 * 网站唯一会话号
	 */
	private String sid;
	
	/**
	 * 需要修改和增减的商品编码
	 */
	private String cprocode;
	
	/**
	 * 商品集合
	 */
	protected List<BuyItemVO> items = new ArrayList<BuyItemVO>();
	
	/**
	 * 商品类型 默认为0 非赠品
	 */
	private String status;
	
	/**
	 * 特价品标志 默认0 非特价
	 */
	private String promflag;
	
	/**
	 * 客户编码
	 */
	private String clientcode;
	/**
	 * 备注
	 */
	private String remark;
	
	/**
	 * 价格类型
	 */
	private String pricetype;
	
	/**
	 * 渠道价格类型
	 */
	private String repricetype;
	
	/**
	 * 配送方式
	 */
	private String disttag;
	
	/**
	 * 供应商编码
	 */
	private String vendorcode;

	/**
	 * 单个商品的信息
	 */
	private ProductsInfo productsinfo;
	
	/**
	 * 需要删除的多个商品编码
	 */
	private String[] itemcodes;
	
	/**
	 * 去结算的提示编码
	 */
	private String msgcode;
	
	/**
	 * 网站类型
	 */
	private String webtype;
	
	/**
	 * 是否被选中
	 */
	private boolean checkitem = true;
	
	public boolean isCheckitem() {
		return checkitem;
	}

	public void setCheckitem(boolean checkitem) {
		this.checkitem = checkitem;
	}

	public boolean isStockfix() {
		return stockfix;
	}

	public void setStockfix(boolean stockfix) {
		this.stockfix = stockfix;
	}

	public int getStockqty() {
		return stockqty;
	}

	public void setStockqty(int stockqty) {
		this.stockqty = stockqty;
	}

	public String getWebtype() {
		return webtype;
	}

	public void setWebtype(String webtype) {
		this.webtype = webtype;
	}

	public String getMsgcode() {
		return msgcode;
	}

	public void setMsgcode(String msgcode) {
		this.msgcode = msgcode;
	}

	public String[] getItemcodes() {
		return itemcodes;
	}

	public void setItemcodes(String[] itemcodes) {
		this.itemcodes = itemcodes;
	}

	public int getWholeqty() {
		return wholeqty;
	}

	public void setWholeqty(int wholeqty) {
		this.wholeqty = wholeqty;
	}

	public int getSubqty() {
		return subqty;
	}

	public void setSubqty(int subqty) {
		this.subqty = subqty;
	}

	public String getCprocode() {
		return cprocode;
	}

	public void setCprocode(String cprocode) {
		this.cprocode = cprocode;
	}

	public ProductsInfo getProductsinfo() {
		return productsinfo;
	}

	public void setProductsinfo(ProductsInfo productsinfo) {
		this.productsinfo = productsinfo;
	}
	public BuyItemVO(){}
	
	public BuyItemVO(ProductsInfo productsinfo){
		this.productsinfo = productsinfo;
	}

	public BuyItemVO(ProductsInfo productsinfo ,int camount){
		this.productsinfo = productsinfo;
		this.camount = camount;
	}
	
	public BuyItemVO(ProductsInfo productsinfo ,int camount,int wholeqty,int subqty){
		this.productsinfo = productsinfo;
		this.camount = camount;
		this.wholeqty = wholeqty;
		this.subqty = subqty;
	}

	public float getSubtotal() {
		return subtotal;
	}

	public void setSubtotal(float subtotal) {
		this.subtotal = subtotal;
	}

	public int getCamount() {
		return camount;
	}

	public void setCamount(int camount) {
		this.camount = camount;
	}

	public String getSid() {
		return sid;
	}

	public void setSid(String sid) {
		this.sid = sid;
	}

	public List<BuyItemVO> getItems() {
		return items;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getPromflag() {
		return promflag;
	}

	public void setPromflag(String promflag) {
		this.promflag = promflag;
	}

	public String getClientcode() {
		return clientcode;
	}

	public void setClientcode(String clientcode) {
		this.clientcode = clientcode;
	}

	public void getClientcode(String clientcode) {
		this.clientcode = clientcode;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getPricetype() {
		return pricetype;
	}

	public void setPricetype(String pricetype) {
		this.pricetype = pricetype;
	}

	public String getRepricetype() {
		return repricetype;
	}

	public void setRepricetype(String repricetype) {
		this.repricetype = repricetype;
	}

	public String getDisttag() {
		return disttag;
	}

	public void setDisttag(String disttag) {
		this.disttag = disttag;
	}

	public String getVendorcode() {
		return vendorcode;
	}

	public void setVendorcode(String vendorcode) {
		this.vendorcode = vendorcode;
	}
	
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj){//内存地址是否相同
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){//是否是同一个类
			return false;
		}
		final BuyItemVO other = (BuyItemVO) obj;
		if (null!=productsinfo.getItemCode() &&  !productsinfo.getItemCode().equals( other.getProductsinfo().getItemCode())) {
		     return false;
		}
		return true;
	}

	public void setPromotionItemVOList(List<PromotionItemVO> promotionItemVOList) {
		this.promotionItemVOList = promotionItemVOList;
	}

	public List<PromotionItemVO> getPromotionItemVOList() {
		return promotionItemVOList;
	}
}
